<% layout('/layouts/default.html', {title: '游泳馆申请管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<#form:form id="inputForm" model="${natatoriumApply}" action="" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="id"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('游泳馆名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${natatoriumApply.name}</span>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('联系人')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${natatoriumApply.contactPerson}</span>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('联系方式')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${natatoriumApply.contactWay}</span>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('场馆描述')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${natatoriumApply.venueDescription}</span>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('城市')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="city" dictType="city" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('区县')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="area" dictType="area" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('场馆地址')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${natatoriumApply.address}</span>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">${text('营业执照图片')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadImage" bizKey="${natatoriumApply.id}" bizType="business_license_image"
									uploadType="image" class="" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">${text('高危证')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadImage1" bizKey="${natatoriumApply.id}" bizType="high_risk_image"
									uploadType="image" class="" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="box-footer">
					<div class="row">
						<div class="col-sm-offset-2 col-sm-10">
							<% if (hasPermi('natatoriumapply:natatoriumApply:edit') && natatoriumApply.applyState == 1){ %>
								<button type="button" class="btn btn-sm btn-primary" id="sumbitChecked"><i class="fa fa-check"></i> ${text('审 核')}</button>&nbsp;
							<% } %>
						</div>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script id="review" type="text/template">
   <div>
	<div class="row">
		<div class="col-xs-12">
			<div class="form-group">
				<label class="control-label col-sm-3" title="">
					<span class="required ">*</span> ${text('审核结果')}：</label>
				<div class="col-sm-9 clearfix">
					<div class="tl_input pull-left mr20">
            			<input type="radio" name="isPass" id="isPass" value="2" checked/>
            			<lable>同意</lable>
        			</div>
        			<div class="tl_input pull-left">
            			<input type="radio" name="isPass" id="isPass" value="3"/>
            			<lable>不同意</lable>
        			</div>
				</div>
			</div>
		</div>
	</div>
</div>
</script>

<script>
$(document).ready(function(){
	var id = '${natatoriumApply.id}';
	
	$("#sumbitChecked").click(function() {
		js.layer.open({
		  type: 1,
		  title: "审核结果",
		  btn:["确定"],
		  area: ['540px', '340px'],
		  shadeClose: true, //开启遮罩关闭
		  content: $("#review").html(),
		  yes: function(index, layero) {
		    var isPass = top.$("input[name='isPass']:checked").val();
		    var data = {
		    	'id': id,
		    	'applyState': isPass
		    }
		    $.ajax({
				url: "${ctx}/natatoriumapply/natatoriumApply/check",
		        type: "post",
		        contentType: "application/json",
		        data: JSON.stringify(data),
		        xhrFields: {
		            withCredentials: true
		        },
		        success: function (data) {
		        	js.showMessage(JSON.parse(data).message);
		        	js.closeCurrentTabPage(function(contentWindow){
	  					contentWindow.page();
	  				});
		        },
		        error: function (e) {
		        	console.log('e',e)
		        }
			})
		  }
		})
	})
})
</script>